/**
 * Created by wangyonghao on 2017/5/13.
 */
angular.module('resetPassword', []).component('resetPassword', {
    templateUrl: 'component/base/resetPassword/reset_password.template.html',
    controller: ['$scope', 'Api','Check','Alert', function ($scope, Api,Check,Alert) {
        $scope.submitResetPassword = function (oldPassword, password, repassword) {
            if(!Check.password(password)){
                return Alert.alertBox('密码为6-20位字符,建议由字母,数字,符号两种以上组合')
            }
            if (password !== repassword) {
                Alert.alertBox('两次密码输入的不相同');
            } else {
                Api.resetPassword(oldPassword, password, function (result) {
                    Alert.alertBox('修改密码成功',null);
                    $scope.$parent.showRePassword = false;
                });
            }
        }
    }]
});